package com.rockwell.sniffyhunter.utils;

public interface IRobotSensors {
	
	public static final short START_OF_SENSORS_STATUS_REF = 1;
	public static final short SENSORS_STATUS_REF = 1;
	public static final short FRONT_DISTANCE_SENSOR1_REF = 2;
	public static final short FRONT_DISTANCE_SENSOR2_REF = 3;
	public static final short FRONT_DISTANCE_SENSOR3_REF = 4;
	public static final short LEFT_DISTANCE_SENSOR1_REF = 5;
	public static final short LEFT_DISTANCE_SENSOR2_REF = 6;
	public static final short RIGHT_DISTANCE_SENSOR1_REF = 7;
	public static final short RIGHT_DISTANCE_SENSOR2_REF = 8;
	public static final short END_OF_SENSORS_STATUS_REF = 8;
	public static final short ACTIVE_MOTOR_ENCODER_REF = 9;
	
	public static final short ARM_UP_SENSOR_BIT = 0;
	public static final short ARM_DOWN_SENSOR_BIT = 1;
	public static final short FRONT_SENSOR1_BIT = 2;
	public static final short FRONT_SENSOR2_BIT = 3;
	public static final short FRONT_SENSOR3_BIT = 4;
	public static final short LEFT_SENSOR1_BIT = 5;
	public static final short LEFT_SENSOR2_BIT = 6;
	public static final short RIGHT_SENSOR1_BIT = 7;
	public static final short RIGHT_SENSOR2_BIT = 8;
	public static final short WHEEL_STATE_BIT = 9;
	
	public static final short ARM_UP_SENSOR_MASK = 0x1 << ARM_UP_SENSOR_BIT;
	public static final short ARM_DOWN_SENSOR_MASK = 0x1 << ARM_DOWN_SENSOR_BIT;
	public static final short FRONT_SENSOR1_MASK = 0x1 << FRONT_SENSOR1_BIT;
	public static final short FRONT_SENSOR2_MASK = 0x1 << FRONT_SENSOR2_BIT;
	public static final short FRONT_SENSOR3_MASK = 0x1 << FRONT_SENSOR3_BIT;
	public static final short FRONT_SENSOR_MASK = 0x7 << FRONT_SENSOR1_BIT;
	public static final short LEFT_SENSOR1_MASK = 0x1 << LEFT_SENSOR1_BIT;
	public static final short LEFT_SENSOR2_MASK = 0x1 << LEFT_SENSOR2_BIT;
	public static final short RIGHT_SENSOR1_MASK = 0x1 << RIGHT_SENSOR1_BIT;
	public static final short RIGHT_SENSOR2_MASK = 0x1 << RIGHT_SENSOR2_BIT;
	public static final short WHEEL_STATE_MASK = 0x1 << WHEEL_STATE_BIT;
	
	public static final int LEFT_SENSOR_DATUM_DIFFERENCE = 500; // left1 has smaller value
	public static final int RIGHT_SENSOR_DATUM_DIFFERENCE = 500; // right1 has smaller value
	
	/**
	 * Detects if the robot has a distance sensor at the left side.
	 * @return
	 */
	boolean hasLeftDistanceSensor();
	
	/**
	 * Detects if the robot has a distance sensor at the front side.
	 * @return
	 */
	boolean hasFrontDistanceSensor();
	
	/**
	 * Detects if the robot has a distance sensor at the right side.
	 * @return
	 */
	boolean hasRightDistanceSensor();
	
	double getActiveEncoderValue();
	double getLeftDistance();
	double getRightDistance();
	int[] getLeftDistances();
	int[] getFrontDistances();
	int[] getRightDistances();
	boolean getFrontStatus();
	boolean detectLeftWall();
	boolean detectRightWall();
	boolean detectFrontWall();
	int getSensorFlags();
	int[] getAllSensorStatus();
	
	/**
	 * Get the orientation of the vehicle.
	 * @return the orientation in degree
	 */
	float getOrientation();
	void setOrientation(float angle);

	boolean isArmUp();
	boolean isArmDown();
	boolean isWheelMoving();
}
